//
//  ActivityTableViewCell.m
//  我的小汽车
//
//  Created by mill on 14/12/31.
//  Copyright (c) 2014年 蓝欧科技. All rights reserved.
//

#import "ActivityTableViewCell.h"

@implementation ActivityTableViewCell

- (void)dealloc
{
    [_activitySite release];
    [_activityImage release];
    [_activityTitle release];
    [_activityTime1 release];
    [_activityTime2 release];

    [super dealloc];
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.contentView.backgroundColor = [UIColor clearColor];
        self.activityImage = [[UIImageView alloc] init];
        [self.contentView addSubview:_activityImage];
        [_activityImage release];
        
        self.activityTitle = [[UILabel alloc] init];
        [self.contentView addSubview:_activityTitle];
        _activityTitle.numberOfLines = 0;
        [_activityTitle release];
        
        
        self.activityTime1 = [[UILabel alloc] init];
        [self.contentView addSubview:_activityTime1];
   
        [_activityTime1 release];
        
        self.activityTime2 = [[UILabel alloc] init];
        [self.contentView addSubview:_activityTime2];
        [_activityTime1 release];
        
        
        self.activitySite = [[UILabel alloc] init];
        [self.contentView addSubview:_activitySite];
        [_activitySite release];
        
        self.time = [[UILabel alloc] initWithFrame:CGRectMake(10, _activityTitle.frame.origin.y + 50, self.frame.size.width/3, 25)];
        self.time.text = @"活动截止时间:";
        [self.contentView addSubview:_time];
        [_time release];
        
        self.place = [[UILabel alloc] initWithFrame:CGRectMake(10, _activityTime2.frame.origin.y + 35, self.frame.size.width / 4, 25)];
        self.place.text = @"活动地点: ";
        [self.contentView addSubview:_place];
        [_place release];
    }
    return self;
}
//
//- (void)NotificationCenter
//{
//    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeNightOrDay:) name:@"changeState" object:nil];
//}
//
//- (void)changeNightOrDay:(NSNotification *)notification
//{
//    NSString *str = [notification.userInfo objectForKey:@"STATE"];
//    if ([str isEqualToString:@"CHANGETONIGHT"]) {
//        
//        self.time.textColor = [UIColor whiteColor];
//        self.place.textColor = [UIColor whiteColor];
//        
//    }
//    else
//    {
//       
//        self.time.textColor = [UIColor blackColor];
//        self.place.textColor = [UIColor blackColor];
//
//        
//    }
//}
//
//

-(void)layoutSubviews
{
    [super layoutSubviews];
  
    self.activityImage.frame = CGRectMake(10, 10, self.frame.size.width - 20, self.frame.size.height/2);
    
    self.activityTitle.frame = CGRectMake(10, _activityImage.frame.size.height + 10, _activityImage.frame.size.width, 50);
    _activityTitle.font = [UIFont systemFontOfSize:18];
    

    self.activityTime2.frame = CGRectMake(self.frame.size.width/3, _activityTitle.frame.origin.y + 50, self.frame.size.width/3 * 2 - 20, 25);
    _activityTime2.textColor = [UIColor colorWithRed:17.0/255.0 green:190.0/255.0 blue:227.0/255.0 alpha:1.0];
    
    self.time.frame = CGRectMake(10, _activityTitle.frame.origin.y + 50, self.frame.size.width/3, 25);
    
    self.activitySite.frame = CGRectMake(20 + self.frame.size.width / 5, _activityTime2.frame.origin.y + 35, self.frame.size.width / 4 * 3 - 20, 25);
    _activitySite.textColor = [UIColor colorWithRed:17.0/255.0 green:190.0/255.0 blue:227.0/255.0 alpha:1.0];
    
    self.place.frame = CGRectMake(10, _activityTime2.frame.origin.y + 35, self.frame.size.width / 4, 25);
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
